import type { RouteRecordRaw } from 'vue-router'

const constantRouter = <RouteRecordRaw[]>[
  //首页
  {
    path: '/',
    name: 'layout',
    component: () => import('@/layout/index.vue'),
    redirect: '/home',
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('@/views/home/index.vue'),
        meta: { title: '首页', show: true },
      },
    ],
  },
  //权限管理
  {
    path: '/acl',
    name: 'acl',
    component: () => import('@/layout/index.vue'),
    meta: { title: '权限管理', show: true },
    redirect: '/acl/tag',
    children: [
      {
        path: '/acl/tag',
        name: 'tag',
        component: () => import('@/views/acl/tag/index.vue'),
        meta: { title: '标签管理', show: true },
      },
      {
        path: '/acl/user',
        name: 'user',
        component: () => import('@/views/acl/user/index.vue'),
        meta: { title: '用户管理', show: true },
      },
    ],
  },
  //商品管理
  {
    path: '/sku',
    name: 'sku',
    component: () => import('@/layout/index.vue'),
    meta: { title: '商品管理', show: true },
    redirect: '/sku/admin',
    children: [
      //管理员管理
      {
        path: '/sku/admin',
        name: 'admin',
        component: () => import('@/views/sku/admin/index.vue'),
        meta: { title: '管理员管理', show: true },
      },
      //系统管理
      {
        path: '/sku/sys',
        name: 'sys',
        component: () => import('@/views/sku/sys/index.vue'),
        meta: { title: '系统管理', show: true },
      },
    ],
  },
  //登录
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue'),
    meta: { title: '登录', Show: false },
  },
  //404
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404/index.vue'),
    meta: { title: '404', Show: false },
  },
  //任意路由
  {
    path: '/:pathMatch(.*)*',
    name: 'any',
    redirect: '/404',
    meta: { title: '任意路由', Show: false },
  },
]
export default constantRouter
